package org.eclipseuseradmin.internal.ui.handlers;

import javax.security.auth.login.LoginException;

import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.rwt.RWT;
import org.eclipseuseradmin.internal.ui.UserAdminUiPlugin;

public class LogoutHandler extends AbstractHandler{

	public Object execute(ExecutionEvent event) throws ExecutionException {
		
		try {
			UserAdminUiPlugin.getLoginContext().logout();
			RWT.getSessionStore().getHttpSession().setMaxInactiveInterval(1);
		} catch (LoginException e) {
			throw new ExecutionException("", e);
		}
		
		return null;
	}

}
